var app=getApp(),api=require('../../../../api.js');
// pages/service/summary/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    summary: ''
  },
  changeInputData: function (e) {
    var that = this;
    var inputName = e.currentTarget.dataset.name;
    var inputVlaue = e.detail.value;
    if (inputName == "summary") {
      that.setData({
        summary: inputVlaue
      });
    }
  },
  sendRequest: function () {
    var summary=this.data.summary
    var that = this;
    // TODO 发送请求
   app.request({
     url:api.user.content,
     method:'post',
     data:{
       cid:wx.getStorageSync('cash').cid,
       content: summary
     },
     success:function(e){
       if(e.code==1){
         wx.showToast({
           title: e.msg,
         })
       }else{
         wx.showModal({
           title: '提示',
           showCancel:false,
           content: e.msg,
         })
       }
     }
   })
  },
  onShow:function(){
    var that=this;
      app.request({
        url: api.user.content,
        data:{
          cid: wx.getStorageSync('cash').cid,
        },
        success:function(e){
          that.setData({
            content:e.content
          })
        }
      })
  }
})